package cn.tedu.totalscore;

import java.io.IOException;

import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.*;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;


public class TotalScoreDriver {
	public static void main(String[] args) throws Exception {
		Configuration conf = new Configuration();
		Job job = Job.getInstance(conf);
		job.setJarByClass(TotalScoreDriver.class);
		job.setMapperClass(TotalScoreMapper.class);
		job.setReducerClass(TotalScoreReducer.class);
		//设置输出类型
		job.setOutputKeyClass(Text.class);
		job.setOutputValueClass(IntWritable.class);
		//设置加载文件路径
		Path pathInput = new Path("hdfs://hadoop1:9000/txt/score2");
		FileInputFormat.addInputPath(job, pathInput);
		Path pathOutput = new Path("hdfs://hadoop1:9000/result/total_score");
		FileOutputFormat.setOutputPath(job, pathOutput);
		job.waitForCompletion(true);

	}
}
